package com.ruicar.afs.cloud.manage.creditchange.util;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruicar.afs.cloud.parameter.commom.entity.TsysAddressParam;
import com.ruicar.afs.cloud.parameter.commom.service.TsysAddressParamService;
import lombok.AllArgsConstructor;

/**
 * @Author chuke
 * @create 2020/9/24 11:41
 */
@AllArgsConstructor
public class TranslateBankCodeUntil {
    private final TsysAddressParamService tsysAddressParamService;

    public static String translateBankCode(String code) {
        String bankName = null;
        switch (code) {
            case "137"://工商银行
                bankName = "工商银行";
                break;
            case "524853"://中国建设银行
                bankName = "中国建设银行";
                break;
            case "101"://中国银行
                bankName = "中国银行";
                break;
            case "5500814"://中国邮储银行
                bankName = "中国邮储银行";
                break;
            default:
                break;
        }
        return bankName;
    }

    public String translatePlace(String code) {
        TsysAddressParam address = tsysAddressParamService.getOne(Wrappers.<TsysAddressParam>lambdaQuery()
                .eq(TsysAddressParam::getValue, code));
        return address.getLabel();
    }
}
